import 'package:flutter/material.dart';
import 'package:flutter_edu_online/constants.dart';

class CourseContent extends StatelessWidget {
  final String number;
  final double duration;
  final String title;
  final bool isDone;
  const CourseContent({
    Key key,
    this.number,
    this.duration,
    this.title,
    this.isDone = false,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Material(
      color: Colors.transparent,
      child: InkWell(
        onTap: () {},
        child: Padding(
          padding: const EdgeInsets.symmetric(
            vertical: 15,
            horizontal: 30,
          ),
          child: Row(
            children: [
              Text(
                number,
                style: kHeadingextStyle.copyWith(
                  color: kTextColor.withOpacity(0.5),
                  fontSize: 32,
                ),
              ),
              SizedBox(width: 20),
              RichText(
                text: TextSpan(
                  children: [
                    TextSpan(
                      text: "$duration mins\n",
                      style: TextStyle(
                        color: kTextColor.withOpacity(0.5),
                        fontSize: 18,
                      ),
                    ),
                    TextSpan(
                      text: title,
                      style: kSubtitleTextSyule.copyWith(
                        fontWeight: FontWeight.w600,
                        height: 1.5,
                        fontSize: 15,
                      ),
                    ),
                  ],
                ),
              ),
              Spacer(),
              Container(
                width: 40,
                height: 40,
                margin: EdgeInsets.only(left: 20),
                decoration: BoxDecoration(
                  shape: BoxShape.circle,
                  color: kGreenColor.withOpacity(isDone ? 1 : 0.5),
                ),
                child: Material(
                  color: Colors.transparent,
                  child: InkWell(
                    borderRadius: BorderRadius.circular(40),
                    onTap: () {},
                    child: Icon(
                      Icons.play_arrow,
                      color: Colors.white,
                    ),
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
